import { defineStore } from 'pinia'
import {ref,computed} from 'vue'
import axios from "axios"; 
export const useCounterStore = defineStore('counter', () => {
    const count = ref(0)
    const increment=()=> {
      count.value++
      action()
    }
    //getter和computed的方法一致
    const computedCount = computed(()=> {
        return count.value*2
      })
    const list=ref([])
    const action=async()=>{
        const res=await axios.get('/api/geoserver/catalog/getAll')
        console.log(res.data.result)
        list.value=res.data.result
        list.value.splice(5)
    }
    return { count, list,increment,computedCount,action}
  })